package com.globaldom.model;

import java.io.Serializable;
import java.util.List;

import javax.jdo.annotations.NotPersistent;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

//@Configurable
@PersistenceCapable
public class Person implements Serializable {

	
//	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
////	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
//	private String id;
	
	@Persistent
	@PrimaryKey
    private String keyName;

	@NotPersistent
	private static final long serialVersionUID = 1L;

	@Persistent
	private String firstName;

	@Persistent
	private String lastName;

	@Persistent
	private Integer PowerLevel;

	@Persistent
	private Integer Level;

	@Persistent
	private Integer Karma;

	@Persistent
	private Integer countryCode;

	@Persistent
	private Integer maxCivilians = 75;

	public Integer getMaxCivilians() {
		return maxCivilians;
	}

	public void setMaxCivilians(Integer maxCivilians) {
		this.maxCivilians = maxCivilians;
	}

	public String getId() {
		return this.keyName;
	}

	public void setId(String id) {
		this.keyName = id;
	}

	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Integer getPowerLevel() {
		return this.PowerLevel;
	}

	public void setPowerLevel(Integer PowerLevel) {
		this.PowerLevel = PowerLevel;
	}

	public Integer getLevel() {
		return this.Level;
	}

	public void setLevel(Integer Level) {
		this.Level = Level;
	}

	public Integer getKarma() {
		return this.Karma;
	}

	public void setKarma(Integer Karma) {
		this.Karma = Karma;
	}

	public Integer getCountryCode() {
		return this.countryCode;
	}

	public void setCountryCode(Integer countryCode) {
		this.countryCode = countryCode;
	}

	public List<Sales> getSales() {
		return null;
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("Id: ").append(getId()).append(", ");
		sb.append("FirstName: ").append(getFirstName()).append(", ");
		sb.append("LastName: ").append(getLastName()).append(", ");
		sb.append("PowerLevel: ").append(getPowerLevel()).append(", ");
		sb.append("Level: ").append(getLevel()).append(", ");
		sb.append("Karma: ").append(getKarma()).append(", ");
		sb.append("CountryCode: ").append(getCountryCode());
		return sb.toString();
	}

	@Override
	public int hashCode() {
		return toString().hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Person)) {
			return false;
		}

		return getId().equals(((Person) obj).getId());
	}

}
